package com.bawei.animator;

import android.animation.TypeEvaluator;

public class BezierEvaluator implements TypeEvaluator<Integer> {
    private int num1;
    private int num2;
    public BezierEvaluator(int num1, int num2) {
        this.num1 = num1;
        this.num2 = num2;
    }



    @Override
    public Integer evaluate(float fraction, Integer startValue, Integer endValue) {

        return (int)(startValue*(1-fraction)*(1-fraction)*(1-fraction)
                +num1*fraction*(1-fraction)*(1-fraction)
                +num2*fraction*fraction*(1-fraction)
                +endValue*fraction*fraction*fraction);

    }
}
